package com.sunshine.ssm.codegenerator;

import com.baomidou.mybatisplus.annotations.IdType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.ConfigGenerator;

/**
 * Created by WeiHong on 2016/12/8.
 */
public class CodeGenerator {

    /*public static void main(String[] args) {
        ConfigGenerator cg = new ConfigGenerator();

        // 配置 MySQL 连接
        cg.setDbDriverName("oracle.jdbc.driver.OracleDriver");
        cg.setDbUser("sitsso");
        cg.setDbPassword("roDs0mGJ13ekXsf");
        cg.setDbUrl("jdbc:oracle:thin:@10.80.2.248:1521:bqtest");
        cg.setTableNames(new String[]{"ALS_USER_SYSTEM"});

        // 配置包名
        cg.setEntityPackage("com.sunshine.ssm.entity");
        cg.setMapperPackage("com.sunshine.ssm.mapper");
        cg.setXmlPackage("com.sunshine.ssm.mapping.xml");
        cg.setServicePackage("com.sunshine.ssm.service");
        cg.setServiceImplPackage("com.sunshine.ssm.service.impl");
        cg.setDbPrefix(false);
        cg.setIdType(IdType.ID_WORKER);

        // 配置保存路径
        cg.setSaveDir("F://desktop/ALS/code");

        // 其他参数请根据上面的参数说明自行配置，当所有配置完善后，运行AutoGenerator.run()方法生成Code
        // 生成代码
        AutoGenerator.run(cg);
    }*/
    public static void main(String[] args) {
        ConfigGenerator cg = new ConfigGenerator();

        // 配置 MySQL 连接
        cg.setDbDriverName("com.mysql.jdbc.Driver");
        cg.setDbUser("root");
        cg.setDbPassword("1111");
        cg.setDbUrl("jdbc:mysql://127.0.0.1:3306/ssm?characterEncoding=utf8");
        cg.setTableNames(new String[]{"user_info"});

        // 配置包名
        cg.setEntityPackage("com.sunshine.ssm.entity");
        cg.setMapperPackage("com.sunshine.ssm.mapper");
        cg.setXmlPackage("com.sunshine.ssm.mapping.xml");
        cg.setServicePackage("com.sunshine.ssm.service");
        cg.setServiceImplPackage("com.sunshine.ssm.service.impl");
        cg.setDbPrefix(false);
        cg.setIdType(IdType.ID_WORKER);

        // 配置保存路径
        //cg.setSaveDir("F://GitHub/SSM/ssm/src/main/java");
        cg.setSaveDir("D://idea-workspace/ssm/src/main/java");

        // 其他参数请根据上面的参数说明自行配置，当所有配置完善后，运行AutoGenerator.run()方法生成Code
        // 生成代码
        AutoGenerator.run(cg);
    }


}
